package com.xx.questionnaire.cis.UserOperation.login.service;

import java.util.List;

import com.xx.questionnaire.cis.UserInfo.entity.User;
import com.xx.questionnaire.dao.UserDaoI;
import com.xx.questionnaire.dao.realize.UserDao;
import com.xx.questionnaire.util.validation.NullValidation;

public class LoginService implements LoginIService {

	 

 
	/**
	 * 关联模块：实体、dao
	 */
	public boolean loginState(User user) {
		String username = user.getName();
		String password = user.getPassword();
		if(NullValidation.ValidationNull(username,password)==true){
			UserDaoI userdao = new UserDao();
		List<String> userList = userdao.getUserTable(username, password);
		//登陆成功的标准
			if(userList.size()==1){
				return true;
			}
		}
		return false;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
			User user = new User("wangzhihua", "123");
			LoginIService ls = new LoginService();
			System.out.println(ls instanceof LoginIService);
			boolean bl = ls.loginState(user);
			System.out.println(bl);
	}

}
